package com.zzyl.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.zzyl.dto.NursingLevelDto;
import com.zzyl.entity.NursingLevel;
import com.zzyl.mapper.NursingLevelMapper;
import com.zzyl.service.NursingLevelService;
import com.zzyl.vo.NursingLevelVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description NursingLevelServiceImpl
 * @Author mengkaishi
 * @Date 2024-07-08
 */
@Service
public class NursingLevelServiceImpl implements NursingLevelService {
    @Autowired
    private NursingLevelMapper nursingLevelMapper;

    /**
     * 根据id查询护理项目等级
     *
     * @param id
     * @return
     */
    @Override
    public NursingLevelVo getById(Integer id) {
        NursingLevelVo nursingLevelVo = nursingLevelMapper.getById(id);
        return nursingLevelVo;
    }

    /**
     * 修改护理等级
     * @param nursingLevelDto
     */
    @Override
    public void update(NursingLevelDto nursingLevelDto) {
        NursingLevel nursingLevel = BeanUtil.toBean(nursingLevelDto,NursingLevel.class);
        nursingLevelMapper.update(nursingLevel);
    }

    /**
     * 根据id删除护理等级
     * @param id
     */
    @Override
    public void delete(Integer id) {
        nursingLevelMapper.delete(id);

    }
}
